package com.xcc.shopanim;

import android.app.Application;

import androidx.appcompat.app.AppCompatDelegate;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.constant.SpinnerStyle;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.ClassicsHeader;

public class ShopApp extends Application {
    private static ShopApp shopApp;

    public static ShopApp getInstance() {
        return shopApp;
    }

    @Override
    public void onCreate() {
        super.onCreate();

        shopApp = this;
        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
        //初始化刷新控件
        SmartRefreshLayout.setDefaultRefreshHeaderCreator((context, layout) -> {
            ClassicsHeader header = new ClassicsHeader(context);
            header.setSpinnerStyle(SpinnerStyle.Scale).setEnableLastTime(false);
            return header;
        });
        SmartRefreshLayout.setDefaultRefreshFooterCreator((context, layout) -> {
            ClassicsFooter footer = new ClassicsFooter(context);
            footer.setSpinnerStyle(SpinnerStyle.Scale);
            //footer.setBackgroundColor(-1);
            return footer;
        });
    }
}
